/*
 * Storage.java
 *
 * Created on April 27, 2007, 8:21 AM
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package org.atomojo.app;

import java.io.IOException;
import java.io.InputStream;
import java.util.Date;
import java.util.Iterator;
import java.util.Map;
import java.util.UUID;
import org.atomojo.app.db.Entry;
import org.infoset.xml.Document;
import org.restlet.Application;
import org.restlet.Context;
import org.restlet.data.MediaType;
import org.restlet.data.Status;
import org.restlet.representation.Representation;

/**
 *
 * @author alex
 */
public interface Storage
{
   interface Query {
      
   }
   
   void start()
      throws Exception;
   
   void stop()
      throws Exception;

   Application getAdministration();
   
   Representation getFeed(String path,UUID id,Iterator<Entry> entries)
      throws IOException;
   
   Representation getFeedHead(String path,UUID id)
      throws IOException;
   
   String getFeedTitle(String path,UUID id)
      throws IOException;
   
   Status storeFeed(String path,UUID feedId,Document feedDoc)
      throws IOException;
   
   boolean feedUpdated(String path,UUID feedId,Date updated)
      throws IOException;
   
   boolean deleteFeed(String path,UUID id)
      throws IOException;
   
   Status storeEntry(String path,UUID feedId,UUID entryId,Document entryDoc)
      throws IOException;
   
   Representation getEntry(String feedBaseURI,String path,UUID feedId,UUID entryId)
      throws IOException;
   
   boolean deleteEntry(String path,UUID feedId,UUID entryId)
      throws IOException;
   
   Status storeMedia(String path,UUID feedId,String name,MediaType type,InputStream data)
      throws IOException;
   
   Representation getMedia(String path,UUID feedId,String name)
      throws IOException;
   
   Representation getMediaHead(String path,UUID feedId,String name)
      throws IOException;
   
   boolean deleteMedia(String path,UUID feedId,String name)
      throws IOException;
   
   Query getQuery(String path,UUID feedId,String name)
      throws IOException;
   
   Query compileQuery(String query)
      throws IOException;

   Representation queryFeed(String path,UUID feedId,Query query,Map<String,String> parameters)
      throws IOException;
   
   Representation queryCollection(String path,UUID feedId,Query query,Map<String,String> parameters)
      throws IOException;
   
}
   
